#ifndef _HELLO_BOX_H_JM_20120624_
#define _HELLO_BOX_H_JM_20120624_

#include "GenericBoxModel.h"

#include <iostream>

namespace jm4bbx {


class HelloBox : public bobox::basic_box2 {
public:
	static const char* BOX_ID; 
	//static String getId() { return "Hello"; }

	typedef GenericBoxModel<HelloBox> BoxModel;

	

	HelloBox(bobox::box_id_type id, bobox::box_tid_type tid, bobox::request *req, 
		const bobox::parameters &params) 
		: bobox::basic_box2(id, tid, req) {
	
			id_ = -1;
			if (params.has_parameter("id")) {
				params.get_parameter("id", id_);
			}
	}
		
	virtual void init_impl() {
		add_group(group_index_type(0), columnType(0), 0);
		add_group(group_index_type(1), columnType(0), 0);
		receive(inType(0), group_index_type(0));
	}

	virtual void sync_mach_etwas() {
		const group& g = get_group(group_index_type(0));
		if (g.poisoned_) {
			//send_poisoned(bobox::outarc_index_type(0));
			std::cout << id_ << ": End !!!" << std::endl;
		}		
		else {
			std::cout << id_ << ": Hello world!!!" << std::endl;			
		}
		receive(inType(0), group_index_type(0));
	}

private:
	int id_;
};

const char* HelloBox::BOX_ID = "Hello";

}
#endif
